<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>

    var a = {flag:0};

    var a1 = a;
    var a2 = a;

    a1.flag=3;
    console.log(a,a1,a2)



    /*var a = 0;

    var a1 = a;
    var a2 = a;

    a1=3;
    console.log(a,a1,a2)*/
</script>
</html>